#!/usr/bin/env python3
import asyncio
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from app.core.redis_client import redis_manager

async def check_whitelist():
    data = await redis_manager.get_json('settings:ip_whitelist')
    print('Redis中的IP白名单数据:')
    print(data)
    
    if data and 'ips' in data:
        print(f'\n白名单IP列表 ({len(data["ips"])} 个):')
        for i, ip_entry in enumerate(data['ips'], 1):
            print(f'{i}. {ip_entry.get("ip", "未知")} - {ip_entry.get("description", "无描述")}')

if __name__ == "__main__":
    asyncio.run(check_whitelist())
